* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background-color: #2d2d2d;
  color: #f8f9fa;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #444;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
}

.chat-list {
  list-style: none;
}

.chat-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #444;
  transition: background-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item:hover {
  background-color: #3d3d3d;
}

.chat-item.active {
  background-color: #4d4d4d;
  border-left: 3px solid #e0e0e0;
}

.chat-item-content {
  flex: 1;
  overflow: hidden;
}

.chat-item-title {
  font-weight: 500;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-delete {
  width: 20px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.chat-item:hover .chat-item-delete {
  opacity: 1;
}

.chat-item-delete:hover {
  color: #c8161d;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid #444;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-footer .button {
  flex: 1;
  text-align: center;
}

.main-content {
  max-width: 70%;
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #fff;
}

.chat-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
}

.model-selector {
  display: flex;
  align-items: center;
}

.model-selector select {
  margin-left: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fff;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-color: #f8f9fa;
}

.message {
  max-width: 90%;
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 18px;
  position: relative;
  line-height: 1.5;
}

.message-user {
  align-self: flex-end;
  background-color: #e0e0e0;
  color: #333;
  border-bottom-right-radius: 5px;
}

.message-ai {
  align-self: flex-start;
  background-color: #f1f1f1;
  color: #333;
  border-bottom-left-radius: 5px;
  padding-bottom: 30px;
  padding-left: 30px;
  padding-right: 30px;
}

.message-time {
  font-size: 10px;
  color: #999;
  margin-top: 5px;
  text-align: right;
  margin-right: 24px;
}

.chat-input {
  width: 100%;
  max-width: 100%;
  padding: 15px;
  border-top: 1px solid #eee;
  background-color: #f8f9fa;
}

.input-container {
  display: flex;
  position: relative;
}

.message-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 24px;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  background-color: #fff;
}

.send-button {
  margin-left: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #666;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.send-button:hover {
  background-color: #888;
}

.send-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.send-button.stop {
  background-color: #333;
}

.send-button.stop:hover {
  background-color: #444;
}

.send-button.stop .icon {
  transform: none;
}

.send-button.stop .icon circle {
  fill: #ff4444;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* 添加图标样式 */
.send-button .icon {
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
}

.button {
  padding: 8px 12px;
  background-color: #c8161d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.button:hover {
  background-color: #d33136ec;
}

.button-secondary {
  background-color: #6b798e;
}

.button-secondary:hover {
  background-color: #6b798ecb;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.modal-title {
  font-size: 18px;
  font-weight: 500;
}

.close-button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #fff;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.model-list {
  margin-top: 20px;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

.model-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid #ddd;
  max-height: 95px;
  overflow-y: hidden;
  border-radius: 4px;
  margin-top: 8px;
  background-color: #f9f9f9;
}

.model-item-info {
  flex: 1;
}

.model-item-name {
  font-weight: 700;
}

.model-item-url {
  font-size: 12px;
  color: #999;
}

.model-item-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex-direction: column;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  text-align: center;
  padding: 20px;
  background-color: #f8f9fa;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.empty-state-text {
  font-size: 18px;
  color: #666;
  margin-bottom: 20px;
}

/* 快捷键提示样式 */
.shortcut-hints {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #f5f5f5;
  padding: 15px 20px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.shortcut-hint {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #555;
}

kbd {
  display: inline-block;
  padding: 3px 6px;
  font-family: monospace;
  font-size: 12px;
  color: #333;
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  margin: 0 4px;
}

.markdown-content pre {
  background-color: #1e1e1e;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1em;
}

.markdown-content code {
  background-color: #f0f0f0;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.markdown-content pre code {
  padding: 0;
  background-color: transparent;
}

.markdown-content blockquote {
  border-left: 4px solid #ddd;
  padding-left: 1em;
  margin-left: 0;
  margin-bottom: 1em;
  color: #666;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1em;
}

.markdown-content table th,
.markdown-content table td {
  border: 1px solid #ddd;
  padding: 8px;
}

.markdown-content table th {
  background-color: #f0f0f0;
  text-align: left;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
}

.markdown-contente ul,
.markdown-content li {
  margin-top: -5px !important;
  margin-bottom: -5px !important;
  padding-top: -5px !important;
  padding-bottom: -5px !important;
}

/* 暗色主题代码高亮 */
.hljs {
  background: #1e1e1e;
  color: #abb2bf;
  border-radius: 4px;
}

/* 通知组件样式 */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background-color: #2d2d2d;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  z-index: 1000;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification.success {
  background-color: #4caf50;
}

.notification.error {
  background-color: #f44336;
}

.notification.warning {
  background-color: #ff9800;
}

.notification-icon {
  font-size: 20px;
}

.notification-content {
  flex: 1;
}

.notification-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.notification-close:hover {
  opacity: 1;
}

/* 模型选择弹窗样式 */
.model-select-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #2d2d2d;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  padding: 20px;
  min-width: 400px;
  max-width: 600px;
  z-index: 1001;
  display: none;
}

.model-select-modal.show {
  display: block;
}

.model-select-title {
  font-size: 14px;
  color: #999;
  margin-bottom: 10px;
  padding: 0 10px;
}

.model-select-search {
  margin-bottom: 10px;
}

.model-select-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.model-select-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.model-select-item {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s;
  border-radius: 4px;
  margin: 2px 0;
}

.model-select-item:hover {
  background-color: #3d3d3d;
}

.model-select-item.active {
  background-color: #4d4d4d;
}

.model-select-name {
  flex: 1;
  font-size: 14px;
}

.model-select-shortcut {
  color: #999;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.model-select-item:hover .model-select-shortcut {
  opacity: 1;
}

/* 滚动条样式 */
.model-select-list::-webkit-scrollbar {
  width: 8px;
}

.model-select-list::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.model-select-list::-webkit-scrollbar-thumb {
  background: #4d4d4d;
  border-radius: 4px;
}

.model-select-list::-webkit-scrollbar-thumb:hover {
  background: #5d5d5d;
}

/* 确认对话框样式 */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-body {
  padding: 15px 0;
}

/* 重试按钮样式 */
.message-retry {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background-color: rgba(102, 102, 102, 0.1);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
}

.message-retry:hover {
  background-color: rgba(102, 102, 102, 0.2);
  transform: scale(1.1);
}

.message-retry .icon {
  width: 12px;
  height: 12px;
  color: #666;
  transition: transform 0.3s ease;
}

.message-ai:hover .message-retry {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.message-retry.spin .icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* 消息操作按钮容器 */
.message-actions {
  position: absolute;
  bottom: 5px;
  right: 5px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

/* 显示消息操作按钮 */
.message:hover .message-actions {
  opacity: 1;
}

/* 消息操作按钮通用样式 */
.message-action {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

/* 复制按钮 */
.message-copy {
  color: #555;
}

.message-copy:hover {
  background-color: #e6f7ff;
  color: #0099ff;
}

/* 编辑按钮 */
.message-edit {
  color: #555;
}

.message-edit:hover {
  background-color: #eaeaea;
  color: #333;
}

/* 删除按钮 */
.message-delete {
  color: #888;
}

.message-delete:hover {
  background-color: #ffe6e6;
  color: #ff4444;
}

/* 确保AI消息中的操作按钮和重试按钮不重叠 */
.message-ai .message-actions {
  right: 35px;
}

/* 图标样式 */
.message-action .icon {
  width: 14px;
  height: 14px;
}

/* 编辑消息模态框 */
.edit-message-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.edit-message-container {
  background-color: #fff;
  border-radius: 8px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.edit-message-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.edit-message-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.close-btn:hover {
  color: #333;
}

.edit-message-textarea {
  width: 100%;
  min-height: 150px;
  padding: 15px;
  border: none;
  resize: vertical;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.edit-message-actions {
  padding: 15px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.edit-message-actions button {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.cancel-btn {
  background-color: #f1f1f1;
  color: #333;
}

.cancel-btn:hover {
  background-color: #e0e0e0;
}

.save-btn {
  background-color: #555;
  color: #fff;
}

.save-btn:hover {
  background-color: #444;
}

/* 下拉菜单样式 */
.dropdown {
  position: relative;
  flex: 1;
}

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 5px;
  background-color: #3d3d3d;
  min-width: 120px;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 10;
  overflow: hidden;
}

.dropdown.active .dropdown-menu {
  display: block;
}

.dropdown-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #f8f9fa;
}

.dropdown-item:hover {
  background-color: #4d4d4d;
}

/* 快捷键列表样式 */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.shortcut-keys {
  display: flex;
  align-items: center;
}

.shortcut-description {
  color: #666;
}

/* 标签页样式 */
.tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 20px;
}

.tab {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tab:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.tab.active {
  border-bottom-color: #6a6a6a;
  color: #6a6a6a;
  font-weight: 500;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 指令列表样式 */
.command-list {
  margin-top: 20px;
  border-top: 1px solid #ddd;
  padding-top: 15px;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 8px;
  background-color: #f9f9f9;
}

.command-item-info {
  flex: 1;
}

.command-item-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.command-item-description {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.command-item-code {
  font-size: 12px;
  color: #888;
  font-family: monospace;
}

.command-item-actions {
  display: flex;
  gap: 5px;
}

.command-item-edit,
.command-item-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #666;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.command-item-edit:hover,
.command-item-delete:hover {
  background-color: #e0e0e0;
}

.form-help {
  margin-block: 10px;
  font-size: 13px;
  color: #666;
  padding: 8px;
  background-color: #f5f5f5;
  border-radius: 4px;
}